Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add successOrNull and fold extensions #66

Merged
merged 3 commits into from
Aug 8, 2023
Merged

Add successOrNull and fold extensions #66

merged 3 commits into from
Aug 8, 2023

Conversation

ZacSweers
Copy link
Collaborator

I've written or seen variations of these a few times in the wild, so promoting them to a top-level set of APIs now to ease use.

This introduces three new functional extensions to ApiResult: successOrNull(), successOrElse(), and fold(). These allow easy happy path-ing in user code to coerce results into a concrete value.

I've written or seen variations of these a few times in the wild, so promoting them to a top-level set of APIs now to ease use.

This introduces three new functional extensions to `ApiResult`: `successOrNull()`, `successOrElse()`, and `fold()`. These allow easy happy path-ing in user code to coerce results into a concrete value.
@ZacSweers ZacSweers requested a review from adamsp August 5, 2023 01:55
@ZacSweers ZacSweers requested a review from adamsp August 8, 2023 21:40
@ZacSweers ZacSweers merged commit fa6ac08 into main Aug 8, 2023
2 checks passed
@ZacSweers ZacSweers deleted the z/extensions branch August 8, 2023 22:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants